{% macro input(id, name='', value='', type='text', size='', readonly='', required='', placeholder='', autofocus='', title='', class='form-control', disabled='', style='') -%}
	{% if name == '' %}
		{% set name = id %}
	{% endif %}
	{% if disabled == 'true' %}
		{% set disabled = 'disabled' %}
	{% endif %}
    <input type="{{ type }}" name="{{name}}" value="{{ value|e }}" id="{{ id }}" data-help="{{title}}" size="{{size}}" style="{{style}}" {{readonly}} {{disabled}} {{required}} {{autofocus}} placeholder="{{placeholder}}" title="{{title}}" class="{{class}}" autocomplete="off" />
{%- endmacro %}

{%- macro checkbox(id, name='', checked='', title='', value='', desc='', disabled='', style='') -%}
	{% if name == '' %}
		{% set name = id %}
	{% endif %}
	{% if disabled == 'true' %}
		{% set disabled = 'disabled' %}
	{% endif %}
	<label for="{{id}}" title="{{title}}" class="{{id}}" style="{{style}}" data-help="{{title}}">{{desc}}</label><input name="{{name}}" type="checkbox" id="{{id}}" value="{{value|e}}" {{checked}} {{disabled}} />
{%- endmacro %}

{%- macro select(id, values, name='', required='', first='', class='', selected='', title='', disabled='true', is_servers='') -%}
	{% if name == '' %}
		{% set name = id %}
	{% endif %}
	{% if disabled == 'true' %}
		{% set disabled = 'disabled' %}
	{% else %}
		{% set disabled = '' %}
	{% endif %}
	<select {{required}} name="{{name}}" id="{{id}}" title="{{title}}" data-help="{{title}}" class="{{class}}">
		{% if first %}
			<option {{disabled}} selected>{{first}}</option>
		{% else %}
			<option {{disabled}} selected>------</option>
		{% endif %}
		{% if is_servers %}
			{% for value in values %}
				{% if value.2 == selected|string() %}
					<option value="{{value.2}}" selected>{{value.1}}</option>
				{% else %}
					<option value="{{ value.2 }}">{{ value.1 }}</option>
				{% endif %}
			{% endfor %}
		{% else %}
			{% for v, des in values.items() %}
				{% if v == selected|string() %}
					<option value="{{v}}" selected>{{des}}</option>
				{% else %}
					<option value="{{v}}">{{des}}</option>
				{% endif %}
			{% endfor %}
		{% endif %}
	</select>
{%- endmacro %}

{%- macro copy_to_clipboard(id='', value='', show='', style='', class='') -%}
	{% if show == '' %}
		{% set show = value %}
	{% endif %}
	<span id="{{id}}" style="{{style}}" class="copyToClipboard {{class}}" data-copy="{{value}}" title="Copy {{value}} to clipboard">{{show}}</span>
{%- endmacro %}
